<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function find(n) {
            // 从1开始找到和刚好大于等于n的值
            let firstNum = 1, secondNum = 1, thirdNum = firstNum + secondNum, count = 2;
            while (thirdNum < n) {
                // console.log(thirdNum);
                thirdNum = firstNum + secondNum;
                firstNum = secondNum;
                secondNum = thirdNum;
                count++;
            }

            // console.log(count);
            if(thirdNum>n){
                return -1
            }
            return count

        }
        // console.log(find(4));

        console.log(find(13));
        // console.log(find(7));
        // console.log(find(8));
        
        
        
    </script>
</body>

</html>